package org.example.mall.admin.model.entity.manage;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.example.mall.admin.constant.vaild.C;
import org.example.mall.admin.constant.vaild.Q;
import org.example.mall.admin.constant.vaild.U;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * <p>
 * 系统标签
 * </p>
 *
 * @author hzq
 * @since 2022-01-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_label")
@ApiModel(value = "SysLabel对象", description = "系统标签")
public class SysLabel extends Model<SysLabel> {

    private static final long serialVersionUID = 1L;

    @NotNull(message = "id不能为空", groups = U.class)
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @NotBlank(message = "标签名称不能为空", groups = {C.class, U.class})
    @ApiModelProperty(value = "标签名称")
    @TableField("label")
    private String label;

    /**
     * @see org.example.mall.admin.model.enums.manage.LabelTypeEnum
     */
    @NotNull(message = "标签类型不能为空", groups = {C.class, Q.class, U.class})
    @ApiModelProperty(value = "标签类型（LabelTypeEnum.class）")
    @TableField("label_type")
    private Integer labelType;

    @ApiModelProperty(value = "扩展字段")
    @TableField("extra")
    private String extra;

    @ApiModelProperty(value = "扩展字段")
    @TableField("expand")
    private String expand;

    @ApiModelProperty(value = "扩展字段")
    @TableField("develop")
    private String develop;

    @ApiModelProperty(value = "排序")
    @TableField("sort")
    private Integer sort;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
